<?php
    
  $aux = explode ( '|', isset($_GET['id']) ? $_GET['id'] : '' );
  $EmployeecontactsUid = str_replace ( '"', '', $aux[0] );
  
  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrEmployeeContacts.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrEmployeeContactsPeer::retrieveByPK( $EmployeecontactsUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrEmployeeContacts' ) ) { 
     $fields['EMPLOYEECONTACTS_UID'] = $tr->getEmployeecontactsUid();
     $fields['EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['FIRSTNAME'] = $tr->getFirstname();
     $fields['LASTNAME'] = $tr->getLastname();
     $fields['RELATIONSHIP_ID'] = $tr->getRelationshipId();
     $fields['SPOUSE'] = $tr->getSpouse();
     $fields['DEPENDENT'] = $tr->getDependent();
     $fields['BENEFICIARY'] = $tr->getBeneficiary();
     $fields['EMERGENCYCONTACT'] = $tr->getEmergencycontact();
     $fields['HOMEPHONE'] = $tr->getHomephone();
     $fields['MOBILEPHONE'] = $tr->getMobilephone();
     $fields['EMAIL'] = $tr->getEmail();
     $fields['ADDRESS1'] = $tr->getAddress1();
     $fields['ADDRESS2'] = $tr->getAddress2();
     $fields['CITY'] = $tr->getCity();
     $fields['STATE_ID'] = $tr->getStateId();
     $fields['ZIPCODE'] = $tr->getZipcode();
     $fields['DATEOFBIRTH'] = $tr->getDateofbirth();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'workflow';
  $G_SUB_MENU = 'hrEmployeeContacts';
  $G_ID_MENU_SELECTED = '';
  $G_ID_SUB_MENU_SELECTED = '';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrEmployeeContactsEdit', '', $fields, 'hrEmployeeContactsSaveSS' );
  G::RenderPage('publish', 'blank');   
?>